<script>
import {data} from "autoprefixer";

export default {
  data() {
    return {
      user:{
        adminId:0
      },
      activeIndex: '1',
      activeIndex2: '1'
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    findadmin() {
      this.$axios.get("/admin/findadmin").then(data=>{
        if (data.data.code==200){
          this.user=data.data.data
        }
      })
    },
    tui(){
      localStorage.clear()
      this.$router.push("/login")
    }
  },
  mounted() {
    this.findadmin()
  }
}
</script>

<template>
  <div >
    <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-menu-item index="1">处理中心</el-menu-item>
      <el-submenu index="2">
        <template slot="title">我的工作台</template>
        <el-menu-item index="2-1">选项1</el-menu-item>
        <el-menu-item index="2-2">选项2</el-menu-item>
        <el-menu-item index="2-3">选项3</el-menu-item>
        <el-submenu index="2-4">
          <template slot="title">选项4</template>
          <el-menu-item index="2-4-1">选项1</el-menu-item>
          <el-menu-item index="2-4-2">选项2</el-menu-item>
          <el-menu-item index="2-4-3">选项3</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-menu-item index="3" disabled>消息中心</el-menu-item>
      <el-menu-item index="4" @click="$router.push('/useradmin')">个人信息</el-menu-item>
      <span v-if="user.adminId!=0" class="hi"> 您好:尊敬的{{user.adminName}}管理员</span>
      <span v-if="user.adminId===0" @click="$router.push('/login')" class="hi">去登陆</span>
      <el-menu-item class="logout" index="4" @click="tui">退出登录</el-menu-item>
    </el-menu>

  </div>

</template>

<style>
.hi{
  margin-left: 800px;
  color: yellow;
  font-size:20px;
}

</style>
